﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;

namespace ServerSideViewStateImplementation
{
    public class Global : System.Web.HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            string[] files = System.IO.Directory.GetFiles(Server.MapPath("~/App_Data/Cache"), "VIEWSTATE_*.cache");
            foreach (string file in files)
                System.IO.File.Delete(file);
        }

        protected void Application_End(object sender, EventArgs e)
        {
            //  Code that runs on application shutdown
            string[] files = System.IO.Directory.GetFiles(Server.MapPath("~/App_Data/Cache"), "VIEWSTATE_*.cache");
            foreach (string file in files)
                System.IO.File.Delete(file);
        }

        

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

       
    }
}